package com.hl.toolkit.server.tycoin.account.slaveservice;

import com.tycoin.account.slaveentity.TycoinAccountCash;
import com.tycoin.account.slaverepository.TycoinAccountCashRepository;
import com.tycoin.common.bean.PageInfo;
import com.tycoin.common.entity.Page;
import com.tycoin.common.repository.AbstractRepository;
import com.tycoin.common.service.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(value = "slaveTransactionManager", readOnly = true)
public class TycoinAccountCashService   extends AbstractService<TycoinAccountCash, Long> {

	@Autowired
	private TycoinAccountCashRepository tycoinAccountCashRepository;
	
	
	@Override
	public AbstractRepository<TycoinAccountCash, Long> getRepository() {
 		return tycoinAccountCashRepository;
	}

	
	
 


	public List<TycoinAccountCash> getAccountCashList(com.tycoin.common.entity.Page page, String userId) {
		
		PageInfo pageInfo =new PageInfo();
 		pageInfo.setSize(page.getEveryPage());
		pageInfo.setPage(page.getBeginIndex());
 		org.springframework.data.domain.Page<TycoinAccountCash> pageList = tycoinAccountCashRepository.getAccountCashByPage( pageInfo.getPageRequest(),userId);
		return pageList.getContent();
	}
	
	
	public TycoinAccountCash findOneBylogno(String logno) {
 		return tycoinAccountCashRepository.findOneBylogno(logno);
	}

	

}
